package com.thingsgrid.appmanager.config;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 功能说明：注册feign form bean
 *
 * @author 李龙飞
 * @since 2019/9/3 11:14
 */

@Configuration
public class MultipartSupportConfig {

	@Autowired
	private ObjectFactory<HttpMessageConverters> messageConverters;

	@Bean
	public Encoder feignFormEncoder(){
		return new SpringFormEncoder(new SpringEncoder(messageConverters));
	}

}
